<!DOCTYPE html>
<html lang="zh-hans">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<script type="text/javascript" src="__SYSMET__/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__SYSMET__/lib/jquery/1.9.1/jquery.js"></script>
<script type="text/javascript" src="__SYSMET__/lib/layer/2.4/layer.js"></script>
<title></title>
<style>
    *{margin:0;padding:0;}
    html,body{width:100%;height:100%;}
    #zzc{width:100%;height:100%;position:fixed;top:0;left:0;background:#000;opacity: .8;z-index: 2;}
    .content{width:500px;height:400px;position:fixed;top:50%;margin-top:-200px;left:50%;margin-left:-250px;background:#fff;border-radius: 12px;z-index: 3;}
    .content .con{width:100%;}
    .content .con>*{display:block;margin:0 auto;}
    .content .con>div{width:50%;display:flex;border-radius: 10px;margin:10px auto 30px;height:70px;border:1px solid #ccc;text-indent: 12px;outline: none;color:#666;}
    .content .con>div input{display:block;width:15px;text-align:center;outline: none;font-size:40px;margin:0 5px;border:none;height:60px;margin-top:5px;text-align:center;color:#666;flex:1;border-bottom:1px solid #999;}
    .content .con>p{height:90px;line-height:90px;text-align: center;font-size:18px;}
    .content .con>a{width:30%;height:50px;line-height:50px;text-align:center;color:#fff;background:#675aa1;border-radius: 8px;}
    .footer{overflow: hidden;width:100%;text-align:center;line-height:60px;height:60px;border-top: 1px solid #ccc;background:#f2f2f2;position:absolute;bottom:0;left:0;}
</style>
</head>
<body>
    <div id="zzc"></div>
    <div class="content" id="content">
        <h3 style="overflow: hidden;height:60px;border-bottom: 1px solid #ccc;background:#f2f2f2;position:relative;">
            <p style="float:left;width:100%;text-align: center;line-height:60px;letter-spacing: 2px;">输入两步验证码</p>
            
        </h3>
        <div class="con">
            <p>请输入由谷歌验证器生成的两步验证码.</p>
            <div>
                <input type="text" placeholder="0" id="first" maxlength="1" onkeyup="clearNoNum(this,event)"  onafterpaste="clearNoNum(this,event)"/>
                <input type="text" placeholder="0" id="first2"  maxlength="1" onkeyup="clearNoNum(this,event)" onafterpaste="clearNoNum(this,event)"/>
                <input type="text" placeholder="0" id="first3"  maxlength="1" onkeyup="clearNoNum(this,event)" onafterpaste="clearNoNum(this,event)"/>
                <input type="text" placeholder="0" id="first4"  maxlength="1" onkeyup="clearNoNum(this,event)" onafterpaste="clearNoNum(this,event)"/>
                <input type="text" placeholder="0" id="first5"  maxlength="1" onkeyup="clearNoNum(this,event)" onafterpaste="clearNoNum(this,event)"/>
                <input type="text" placeholder="0" id="first6"  maxlength="1" onkeyup="clearNoNum(this,event)" onafterpaste="clearNoNum(this,event)"/>
                <input type="hidden" value="{$username}" id="username"/>               
            </div>
            <a href="javascript:;" id="submit">验证</a>
        </div>
        <div  class="footer" >
            如果您遗失了您的谷歌身份验证器，请<a href="javascript:;" style="text-decoration: none;">联系客服</a>
        </div>
    </div>
<script>
  function clearNoNum(obj){
        obj.value = obj.value.replace(/[^\d]/g,""); 
        if(obj.value.length==1){
            $(obj).next().focus()
        }
        if (event.keyCode == 8) {  
            if($(obj).attr('id')!='first') {
                $(obj).prev().focus()
            }
        }  
  }
  
  $('#close').click(function(){
    $('#zzc').hide()
    $('#content').hide()
  })
</script>



<script type="text/javascript">
$(function (){  
    $("#submit").click(function(){
        
        var kouling1=$("#first").val();
        var kouling2=$("#first2").val();
        var kouling3=$("#first3").val();
        var kouling4=$("#first4").val();
        var kouling5=$("#first5").val();
        var kouling6=$("#first6").val();
        var kouling=kouling1+kouling2+kouling3+kouling4+kouling5+kouling6;
        var username=$("#username").val();

        
        if(kouling == ''){
            layer.alert('请输入口令!', {icon: 5});
            return false;
        };
        
        $.ajax({
            
            
            //后台获取数据的路径
            url: '/index/kkk/check',
            //参数
            data: {kouling:kouling,username:username},
            //传输方式
            type: 'post',
            //获取到的数据类型
            dataType:'json',
            //成功获取到数据后
            success: function (data) {


               if(data==1){
                    var index=parent.layer.getFrameIndex(window.name);
                    parent.location.href='/admin/index/index';
                    parent.layer.close(index);
                    
                    
                }else{
                    layer.alert('输入的口令错误', {icon: 5});
                }
            }
        })
    }) 
$("#first").focus()
})
</script>
</body>
</html>
